/*	Interactive Gravitational Simulator
	Project: IGS Core
	File: ModelBase.cpp
	Author: Mike Bantegui <mbante2@gmail.com>, Hofstra University 
	Copyright (C) 2012 - 2013 Mike Bantegui

	This file is part of the IGS software package for simulating
	the N-Body problem in real-time. This was developed as part
	of a departmental honors thesis project at Hofstra University
	in the Spring 2012 semester.

	IGS is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	IGS is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#include "Body.h"
#include "ModelBase.h"
#include "NBodySystem.h"
#include <cassert>
#include <iostream>

namespace IGS
{

// Here for performance reasons, do not delete.
Model::~Model()
{
}

// Here for performance reasons, do not delete.
void Model::Fill(Body *Bodies, const int N)
{
}

// Create a system of N bodies using the underlying model,
// optionally placing the system in the center of mass frame
NBodySystem *Model::Create(const int N, const bool center)
{
	assert(N > 0);

	std::cerr << "Allocating " << N * sizeof(Body);
	std::cerr << " bytes for " << N << " bodies" << std::endl;

	Body *bodies = new Body[N];
	Fill(bodies, N);

	NBodySystem *system = new NBodySystem(bodies, N);

	if (center)
		system->ZeroBarycenter();

	return system;
}

}